# Tanım: VLC, özgür ve açık kaynak kodlu, platformlar arası, bir ortam oynatıcı ve çatıdır.
# URL: http://www.videolan.org/vlc/
# Paketçi: milisarge
# Gerekler: opus libssh2 qt5-base qt5-x11extras qt5-svg x264 flac libmad glib dbus libupnp libvlc libidn librsvg alsa-lib xorg-libxinerama xorg-libxpm libvpx libcdio vcdimager live libdvdcss libdvdread libdvdnav libogg libtheora lame faac libvorbis ffmpeg28 faad2 liba52 libmpeg2 libmpcdec fribidi lua libdv speex
# Grup: medya

isim=vlc
surum=3.0.3
devir=1

kaynak=(https://download.videolan.org/${isim}/${surum}/${isim}-${surum}.tar.xz
        update-vlc-plugin-cache.hook
        lua53_compat.patch
        vlc-qt5.11.patch)
	
derle() {
echo > /usr/bin/c99-gcc <<\EOF
#!/bin/bash
gcc -std=gnu99 "$@"
EOF
chmod a+x /usr/bin/c99-gcc

	cd $isim-$surum
  sed -e 's:truetype/ttf-dejavu:TTF:g' -i modules/visualization/projectm.cpp
  sed -e 's|-Werror-implicit-function-declaration||g' -i configure
  patch -Np1 < "${SRC}/lua53_compat.patch"
  sed 's|whoami|echo builduser|g' -i configure
  sed 's|hostname -f|echo arch|g' -i configure
  patch -Np1 < "${SRC}/vlc-qt5.11.patch"
	
  export CFLAGS+=" -I/usr/include/samba-4.0"
  export CPPFLAGS+=" -I/usr/include/samba-4.0"
  export CXXFLAGS+=" -std=c++11"
  export LUAC=/usr/bin/luac
  export LUA_LIBS="$(pkg-config --libs lua)"
  export RCC=/usr/bin/rcc-qt5
  BUILDCC="/usr/bin/gcc -std=gnu99"
  ./configure --prefix=/usr \
              --sysconfdir=/etc \
              --disable-rpath \
              --enable-nls \
              --enable-archive \
              --enable-dvdread \
              --enable-dvdnav \
              --enable-bluray \
              --disable-opencv \
              --enable-smbclient \
              --enable-sftp \
              --enable-realrtsp \
              --enable-ogg \
              --enable-mod \
              --enable-mpc \
              --enable-mad \
              --enable-mpg123 \
              --enable-gst-decode \
              --enable-avcodec \
              --enable-libva \
              --enable-avformat \
              --enable-postproc \
              --enable-faad \
              --enable-vpx \
              --disable-fdkaac \
              --enable-a52 \
              --enable-flac \
              --enable-libmpeg2 \
              --enable-vorbis \
              --enable-speex \
              --enable-opus \
              --enable-oggspots \
              --disable-schroedinger \
              --enable-png \
              --enable-jpeg \
              --enable-x264 \
              --enable-x265 \
              --enable-zvbi \
              --enable-libass \
              --enable-vdpau \
              --enable-wayland \
              --enable-sdl-image \
              --enable-freetype \
              --enable-fribidi \
              --enable-harfbuzz \
              --enable-fontconfig \
              --enable-svg \
              --enable-svgdec \
              --enable-aa \
              --enable-caca \
              --enable-pulse \
              --enable-alsa \
              --enable-samplerate \
              --enable-soxr \
              --enable-chromaprint \
              --enable-chromecast \
              --enable-qt \
              --enable-skins2 \
              --enable-libtar \
              --enable-ncurses \
              --enable-lirc \
              --enable-projectm \
              --enable-avahi \
              --enable-mtp \
              --enable-upnp \
              --enable-libxml2 \
              --disable-libgcrypt \
              --enable-gnutls \
              --enable-taglib \
              --enable-secret \
              --disable-update-check \
              --enable-notify \
              --enable-vlc
  make
  make DESTDIR="${PKG}" install

  for res in 16 32 48 128 256; do
    install -Dm 644 "${SRC}/vlc-${pkgver}/share/icons/${res}x${res}/vlc.png" \
                     "${PKG}/usr/share/icons/hicolor/${res}x${res}/apps/vlc.png"
  done
  install -Dm 644 "${SRC}/update-vlc-plugin-cache.hook" -t "${PKG}/usr/share/libalpm/hooks"

}